<template>
  <!-- 项目考核-津贴详情 6-3 -->
  <div>
    <div class="table-wrap" v-if="!allowanceDetailAddShow">
      <div class="table-top">
        <a-button type="primary" class="buttonColorGreen addButton ml10 mr10" @click="allowanceDetailAddShow=true">新增</a-button>
        <a-input-search placeholder="请输入内容" v-model="search" class="search" @search="onSearch" />
        <a-button type="primary" class="buttonColorGreen ml10 mr10">查询</a-button>
        <a-button type="primary" class="buttonColorGreen ml10 mr10" @click="reset">重置</a-button>
        <a-button type="primary" class="buttonColorGreen ml10 mr10" @click="back">返回</a-button>
        <span class="label">累计津贴金额</span>
        <a-input placeholder="请输入内容" class="search" />
      </div>
      <div class="table">
        <a-table :columns="columns" :dataSource="tableData" bordered>
          <span slot="operation">
            <router-link to="/checkinAdd" class="actionButton">
              <a-icon type="check-circle" />修改</router-link>
            <a-divider type="vertical" />
            <span class="actionButton">
              <a-icon type="close" />删除</span>
          </span>
        </a-table>
      </div>
    </div>
    <allowanceDetailAdd v-if="allowanceDetailAddShow" :allowanceDetailAddShow.sync="allowanceDetailAddShow"></allowanceDetailAdd>
  </div>

</template>

<script>
import allowanceDetailAdd from '@/page/assess/allowanceDetailAdd'
const columns = [{   //表格表头
  title: '序号',
  dataIndex: 'number',
  scopedSlots: { customRender: 'number' },
},
{
  title: '时间',
  className: 'objectName',
  dataIndex: 'objectName',
},
{
  title: '分配人',
  dataIndex: 'objectType',
},
{
  title: '金额',
  dataIndex: 'price',
},
{
  title: '年份',
  dataIndex: 'allPrice',
},
{
  title: '操作',
  // dataIndex: 'operation',
  scopedSlots: { customRender: 'operation' },
}
];

const tableData = [//表格数据
  {
    number: '1',
    objectName: '2019-03-04',
    objectNum: '300,000.00',
    checkinTime: 'xx测绘公司',
    objectType: '张三',
    price: '50',
    allPrice: 2019
  },
  {
    number: '2',
    objectName: '2019-03-04',
    objectNum: '1,256,000.00',
    checkinTime: 'xx测绘公司',
    objectType: '张三',
    price: '50',
    allPrice: 2019
  },
  {
    number: '3',
    objectName: '2019-03-04',
    objectNum: '120,000.00',
    checkinTime: 'xx测绘公司',
    objectType: '张三',
    price: '50',
    allPrice: 2019
  }
];

export default {
  components: {
    allowanceDetailAdd
  },
  props: {
    allowanceDetailShow: Boolean
  },
  data() {
    return {
      tableData,
      columns,
      search: '',
      form: this.$form.createForm(this),
      allowanceDetailAddShow: false
    }
  },
  methods: {
    onSearch() {   //搜索

    },
    onDelete(key) {  //删除
      const dataSource = [...this.dataSource]
      this.dataSource = dataSource.filter(item => item.key !== key)
    },
    reset() {  //重置
      this.search = ""
    },
    back() {
      this.$emit('update:allowanceDetailShow', false)
    }
  }
}
</script>

<style scoped>
.label {
  margin: 5px 0 0 70px;
}
</style>

